<?php

	class ThemeModel
	{		
		public function select()
		{
			$res = array();
		
			if ($handle = opendir(THEMES_PATH)) 
			{
				while (false !== ($file = readdir($handle))) 
				{
					if ($file == "." || $file == ".." || is_file($file)) continue;
					
					$instance = eb_module_file_new_instance("Core/ThemeVO");
					
					$instance->name = $file;
										
					$res []= $instance;
				}

				closedir($handle);
			}
			
			return $res;
		}
		
		public function insert($vo)
		{
			if (!is_dir(THEMES_PATH.$vo->name))
			{
				if (@mkdir(THEMES_PATH.$vo->name))
				{
					return true;
				}
			}
			
			return false;
		}
	}